{template header}


<style>
    .plan-show-content{}
    .plan-show-content img{max-width: 100%;}
</style>

<div class="container">



<div class="row">


<div class="col-md-8">









    <div class="panel panel-default">
        <div class="panel-body">


            <div class="page-header">
                <h1>{$strPlan[title]}                     <small>

                </small></h1>
            </div>

            <div class="row">
                <div class="col-md-6"><img style="width:100%;" title="点击看大图" src="{if $strPlan[photo]}{php echo tsXimg($strPlan[photo],'plan',500,'',$strPlan[path])}{else}{SITE_URL}app/plan/skins/default/plan.jpg{/if}" /></div>
                <div class="col-md-6">

                    <div class="c9 f12" style="line-height: 25px">

                        发布者： <a href="{tsUrl('user','duty',array('id'=>$strPlan[user][userid]))}">{$strPlan[user][username]}</a> <br/>
                        方案类型： <a href="{tsUrl('plan','type',array('id'=>$strPlan['type']['typeid']))}">{$strPlan[type][typename]}</a><br/>
                        申报活动人数：{$strPlan[count_userwish]}<br/>
                        完成活动人数：{$strPlan[count_userdo]}<br/>
                        点赞数：{$strPlan[count_recommend]}<br/>
                    </div>

                    <div class="tar">
                        {if $TS_USER[userid]&&$strPlan[userid]!=$TS_USER[userid]}
                        <a class="pull-right" style="margin-left: 5px" href="javascript:void('0');" onclick="recommend({$strPlan[planid]})">{if $isRecommend==0}<i class="fa fa-heart-o"></i> 赞{else}<i class="fa fa-heart"></i> 取消{/if}</a>
                        {/if}

                            {if $isPlanUser>0}
                                {if $isPlanGeter== 0 }
                                     <a class="btn btn-default" href="javascript:void('0');" onclick="cancelPlan('{$strPlan[planid]}');"> 我放弃</a>
                                {/if}
                            {else}
                                <a class="btn btn-success" href="javascript:void('0');" onclick="doPlanForm('{php echo intval($TS_USER[userid])}')">我申报</a>
                            {/if}
                    </div>

                </div>
            </div>












</div>

</div>









    <div class="panel panel-default">
        <div class="panel-heading">方案详情</div>
        <div class="panel-body">
            <div class="plan-content">
                <div class="plan-view">

                    <p>{$strPlan[content]}</p>
                </div>
            </div>
<div style="text-align:right;">
{if $GLOBALS[TS_USER][userid] == $strPlan[userid] || $GLOBALS[TS_USER][isadmin]=='1'}
<a href="{tsUrl('plan','edit',array('ts'=>'base','planid'=>$strPlan['planid']))}">修改</a>
    &nbsp;&nbsp;<a href="{SITE_URL}index.php?app=plan&ac=delete&ts=base&planid={$strPlan[planid]}&token={$_SESSION['token']}"  onClick="return confirm('确定删除吗?')">删除</a>
{/if}
</div>

</div>
</div>




    <div class="panel panel-default">
        <div class="panel-heading">{if $GLOBALS[TS_USER][userid] == $strPlan[userid] || $GLOBALS[TS_USER][isadmin]=='1'}<a href="{tsUrl('plan','edit',array('ts'=>'join','planid'=>$planid))}">{/if}申报人{if $GLOBALS[TS_USER][userid] == $strPlan[userid] || $GLOBALS[TS_USER][isadmin]=='1'}</a>{/if} <small>(合计申报活动人数{$strPlan[count_userwish]}，名字为绿色表示已经完成)</small></div>
        <div class="panel-body">



            <div class="facelist">
                <ul>
                {loop $arrDoUser $key $item}
                <li>
                    <a href="{tsUrl('user','duty',array('id'=>$item[userid]))}">
                        <img class="img-circle" src="{$item['user'][face]}" alt="{$item['user']['username']}"  width="48" height="48" />
                    </a>
                    <div class="username">
                        {if $item['status']==0}
                        <a {if $GLOBALS[TS_USER][userid] == $strPlan[userid] || $GLOBALS[TS_USER][isadmin]=='1'}href="javascript:void('0');" onclick="attendPlan({$strPlan[planid]},{$item['userid']})"{/if} style="color:orange">{$item['user']['username']}({$item[quota]})</a>
                        {else}
                        <a {if $GLOBALS[TS_USER][userid] == $strPlan[userid] || $GLOBALS[TS_USER][isadmin]=='1'}href="javascript:void('0');" onclick="absentPlan({$strPlan[planid]},{$item['userid']})"{/if} style="color: green">{$item['user']['username']}({$item[quota]})</a>
                        {/if}
                    </div>
                </li>
                {/loop}
                </ul>
            </div>



</div>
</div>


    <div class="panel panel-default">
        <div class="panel-heading">你的回应</div>
        <div class="panel-body">

            <div class="comment">

<ul>

{loop $arrComment $key $item}
<li class="clearfix">
    <div class="user-face">
        <a href="{tsUrl('user','duty',array('id'=>$item[user][userid]))}"><img title="{$item[user][username]}" alt="{$item[user][username]}" src="{$item[user][face]}" class="pil img-circle" width="48" height="48" /></a>
    </div>
    <div class="reply-doc">
            <h4>{php echo date('Y-m-d H:i:s',$item[addtime])}
                <a href="{tsUrl('user','topic',array('id'=>$item[userid]))}">{$item[user][username]}</a>
            </h4>
        <p>{$item[content]}</p>
	
	   {if $GLOBALS[TS_USER][userid] == $strPlan[userid]|| $GLOBALS[TS_USER][isadmin]=='1'}
        <div class="group_banned">
            <span><a class="j a_confirm_link" onclick="return confirm('确定删除?')" href="{SITE_URL}index.php?app=plan&ac=delete&ts=comment&planid={$strPlan['planid']}&commentid={$item['commentid']}">删除</a>
            </span>
        </div>
	{/if}
	
    </div>
</li>
{/loop}
</ul>

            </div>

<div class="page">{$pageUrl}</div>

{if $GLOBALS[TS_USER][userid] == ''}
<div style="font-size:14px;padding:40px 0;text-align:center;">请登录后回应本方案^_^</div>
{else}
<div>
<form method="POST" action="{tsUrl('plan','comment')}" id="formMini">
    <div class="wangeditor_toolbar" id="tseditor"></div>
    <div class="wangeditor_text" id="tseditor2"></div>
    <div style="display: none"><textarea id="content" name="content"></textarea></div>
<input type="hidden" name="planid" value="{$strPlan[planid]}" />
<input class="btn btn-success" type="submit" value="发表回复">
</form>
</div>
{/if}

</div>

</div>


</div>


<div class="col-md-4">




    <div class="panel panel-default">
        <div class="panel-body">
<a href="{tsUrl('plan','type',array(id=>$strPlan[type][typeid]))}">更多{$strPlan[type][typename]}方案</a>
</div>
</div>





{if $strPlan['coordinate']}

    <div id="container" style="width:100%;height:300px;"></div>

    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=dbf1281241fe7a7a9c04b486e1a31651"></script>
    <script type="text/javascript">
        //初始化地图对象，加载地图
        var map = new AMap.Map("container", {
            resizeEnable: true,
            center: [{$strPlan['coordinate']}],//地图中心点
            zoom: 13 //地图显示的缩放级别
        });
        //添加点标记，并使用自己的icon
        new AMap.Marker({
            map: map,
            position: [{$strPlan['coordinate']}],
            icon: new AMap.Icon({
                size: new AMap.Size(40, 50),  //图标大小
                image: "http://webapi.amap.com/theme/v1.3/images/newpc/way_btn2.png",
                imageOffset: new AMap.Pixel(0, -60)
            })
        });
    </script>

    {/if}




    <!--广告位-->
    {php doAction('gobad','300')}


</div>


</div>
</div>


<div id="do_plan_form" style="display:none;">

<form  id="comm-form" class="form-horizontal" method="post" action="{SITE_URL}index.php?app=plan&ac=do&ts=join">
    <div class="form-group">
        <label class="col-sm-2 control-label"></label>
        <div class="col-sm-10">
            请在申报后七天内完成
        </div>
    </div>
  <div class="form-group">
    <label class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="username">
    </div>
  </div>

   <div class="form-group">
    <label class="col-sm-2 control-label">手机</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" name="phone" value="$GLOBALS[TS_USER][phone]">
    </div>
  </div>


    <div class="form-group">
        <label class="col-sm-2 control-label">活动人数</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="quota" value="{$strPlan['quota']}">
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">分馆：</label>
        <div class="col-sm-10">
            <select  name="groupid" id="groupid" class="form-control">
                <option></option>
                {loop $arrGroup $key $item}
                <option value="{$item['groupid']}">{$item['groupname']}</option>
                {/loop}
            </select>
        </div>
    </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
	
	<input type="hidden" name="planid" value="{$strPlan['planid']}" />
	
      <button type="submit" class="btn btn-success">点击提交</button>
    </div>
  </div>
</form>

</div>

<script>
    $(function(){
        $('#formMini').on('submit', function(e) {

            var content  = $('#content').val();

            var text = Trim(content,'g');
            if(text == ''){
                bootbox.alert('内容不能为空');
                return false;
            }

        });

    });

    //确认出席
    function attendPlan(planid,userid){


        if (confirm('确定此人已完成方案了吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=plan&ac=do&ts=attend",
                data: "planid="+planid+"&memberid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

    //确认缺席
    function absentPlan(planid,userid){


        if (confirm('确定此人爽约了吗？')) {

            $.ajax({
                type: "POST",
                url: siteUrl+"index.php?app=plan&ac=do&ts=absent",
                data: "planid="+planid+"&memberid="+userid,
                beforeSend:function(){
                },
                success:function(result){
                    if(result == '1'){
                        window.location.reload();
                    }
                }
            });

        }
    }

</script>
{php doAction('tseditor','mini')}
{template footer}